package de.wellenblau.wow3D
{
	import fr.seraf.wow.core.WOWEngine;
	import fr.seraf.wow.primitive.WBox;
	
	import org.papervision3d.materials.utils.MaterialsList;
	import org.papervision3d.objects.primitives.Cube;
	
	public class physicCube3D extends Cube implements physicDisplayObject3D
	{
		private var _size:int;
		private var _physicObject:WBox;
		
		public function physicCube3D(x:int,y:int,z:int,size:int,mat:MaterialsList)
		{
			super(mat,size,size,size,1,1,1);
			
			this.x = x;
			this.y = y;
			this.z = z;
			
			_size = size;
		}
		
		public function createPhysicObjet(wow:WOWEngine):void{
			_physicObject = new WBox(this.x,this.y,this.z,_size,wow);
		}
		
		public function getPhysicObject():Object{
			return _physicObject.centerSphere;
		}
		
		public function syncObjects():void{
			this.x = _physicObject.centerSphere.px;
			this.y = _physicObject.centerSphere.py;
			this.z = _physicObject.centerSphere.pz;
			
			this.rotationX = _physicObject.springRotation.rotationX;
			this.rotationY = _physicObject.springRotation.rotationY;
			this.rotationZ = _physicObject.springRotation.rotationZ;
		}

	}
}